﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace NetStatistics
{
	[Serializable]
	public class ActiveListener
	{
		private IPAddress address;
		public IPAddress Address
		{
			get { return address; }			
		}

		private int port;
		public int Port
		{
			get { return port; }			
		}

		private NetProtocol protocol;
		public NetProtocol Protocol
		{
			get { return protocol; }			
		}

		public ActiveListener(IPEndPoint ipEndPoint, NetProtocol protocol)
		{
			this.address = ipEndPoint.Address;
			this.port = ipEndPoint.Port;
			this.protocol = protocol;
		}

		public override bool Equals(object obj)
		{
			ActiveListener listener = obj as ActiveListener;

			if (listener == null)
				return false;

			return (this.Address.ToString() == listener.Address.ToString()
				&& this.Port == listener.Port
				&& this.Protocol == listener.Protocol);
		}
	}
}
